package edu.mse.camel.client.whiteboard.gef.ui.editor;

import java.util.HashMap;
import java.util.Map;

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.graphics.Image;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.swt.graphics.Image;
import org.eclipse.jface.resource.ImageDescriptor;


public class SaveImages {
	
	 public static final String ENUM_LITERAL = "EEnumLiteral.gif"; //$NON-NLS-1$
	 public static final String SNAP = "geometry.gif"; //$NON-NLS-1$
	 public static final String SNAP_DISABLED = "geom_dis.gif"; //$NON-NLS-1$
	 public static final String SAVE_IMAGE = "save_edit.gif"; //$NON-NLS-1$
	 public static final String SAVE_IMAGE_DISABLED = "save_edit_disabled.gif"; //$NON-NLS-1$

	 private static final Map stringToImage = new HashMap();

	 private SaveImages() {}

	 /**
	  * Clients should not dispose the Image returned.
	  * 
	  * @param key  the key (one of the constants defined in this class)
	  * @return the Image associated with the given key
	  */
	 public static Image getImage(String key) {
	 	Image img = (Image)stringToImage.get(key);
	 	if (img == null) {
	 		img = getImageDescriptor(key).createImage();
	 		stringToImage.put(key, img);
	 	}
	 	return img;
	 }

	 public static ImageDescriptor getImageDescriptor(String key) {
	 	return ImageDescriptor.createFromFile(SaveImages.class, key);
	 }

}
